<template>
  <div id="descriptions">
      <template>
        <el-avatar shape="square" :size="400" :src="renderObj.headimgurl"></el-avatar>
      </template>
    <el-descriptions title="用户信息">
      <el-descriptions-item label="用户名">{{renderObj.name}}</el-descriptions-item>
      <el-descriptions-item label="年龄">{{renderObj.age}}</el-descriptions-item>
      <el-descriptions-item label="学历">
        <el-tag size="small">{{renderObj.degree}}</el-tag>
      </el-descriptions-item>
      <el-descriptions-item label="城市">{{renderObj.city}}</el-descriptions-item>
      <el-descriptions-item label="班级">{{renderObj.class}}</el-descriptions-item>
      <el-descriptions-item label="项目地址">{{renderObj.productUrl}}</el-descriptions-item>
      <el-descriptions-item label="创建时间">{{renderObj.cTime}}</el-descriptions-item>
      <el-descriptions-item label="描述"
        >{{renderObj.description}}</el-descriptions-item
      >
    </el-descriptions>
  </div>
</template>
<script>
  export default {
    data(){
      return {
        renderObj:{
          age: "18",
          cTime: "2022-4-25",
          city: "ff",
          class: "ff",
          degree: "ff",
          description: "ff",
          headimgurl: "https://cube.elemecdn.com/9/c2/f0ee8a3c7c9638a54940382568c9dpng.png",
          name: "ff",
          productUrl: "ff",
          sId: "ff",
          _id: "ff"
        },
      }
    },
    created(){
      this.fn()
    },
    methods: {
      fn(){
        // console.log(this.$router.currentRoute.params);
        if(this.$router.currentRoute.params._id){
          this.renderObj = this.$router.currentRoute.params
          // console.log(80);
        }else{
          // console.log(50);
        }
      }
    },
  }
  //思路，在学院列表点击查看按钮时跳转到当前页：
  //1.把当前点击的对象传过来
  //2.新建一个用来渲染空对象，渲染这个对象达到显示默认值的目的
  //3.传过来的对象赋值给渲染对象
</script>